package cn.edu.xmu.restfuldemo.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 商品规格
 * @author Ming Qiu
 **/
@Getter
@Setter
@JsonIgnoreProperties(ignoreUnknown = true)
public class Product implements VoObject, Serializable {

    /**
     * 代理对象
     */
    private ProductPo productPo;
    /**
     * 浮动价格
     */
    private PriceStockPo priceStockPo;

    /**
     * 无参构造函数
     */
    public Product() {
        this.productPo = new ProductPo();
        this.priceStockPo = null;
    }

    /**
     * 构造函数
     * @param productPo 代理对象
     */
    public Product(ProductPo productPo) {
        this.productPo = productPo;
        this.priceStockPo = null;
    }
    @Override
    public Object createVo(){
        return new ProductRetVo(this);
    }

    public Integer getId() {
        return productPo.getId();
    }

    public void setId(Integer id) {
        this.productPo.setId(id);
    }

    public Integer getGoodsId() {
        return productPo.getGoodsId();
    }

    public void setGoodsId(Integer goodsId) {
        productPo.setGoodsId(goodsId);
    }

    public String getName() {
        return productPo.getName();
    }

    public void setName(String name) {
        this.productPo.setName(name);
    }

    public String getDetail() {
        return productPo.getDetail();
    }

    public void setDetail(String detail) {
        productPo.setDetail(detail);
    }

    public String getImageUrl() {
        return productPo.getImageUrl();
    }

    public void setImageUrl(String imageUrl) {
        productPo.setImageUrl(imageUrl);
    }

    public Integer getOriginalPrice() {
        return productPo.getOriginalPrice();
    }

    public void setOriginalPrice(Integer originalPrice) {
        productPo.setOriginalPrice(originalPrice);
    }





    public Integer getState() {
        return productPo.getState();
    }

    public void setState(Integer state) {
        productPo.setState(state);
    }

    public Integer getWeight() {
        return productPo.getWeight();
    }

    public void setWeight(Integer weight) {
        productPo.setWeight(weight);
    }

    public LocalDateTime getGmtCreate() {
        return productPo.getGmtCreate();
    }

    public void setGmtCreate(LocalDateTime gmtCreate) {
        productPo.setGmtCreate(gmtCreate);
    }

    public LocalDateTime getGmtModified() {
        return productPo.getGmtModified();
    }

    public void setGmtModified(LocalDateTime gmtModified) {
        productPo.setGmtModified(gmtModified);
    }

    private List<Goods> goodsList;

    public List<Goods> getGoodsList() {
        return goodsList;
    }

    public void setGoodsList(List<Goods> goodsList) {
        this.goodsList = goodsList;
    }

    @Override
    public boolean equals(Object o) {
        return productPo.equals(o);
    }

    @Override
    public int hashCode() {
        return productPo.hashCode();
    }

    @Override
    public String toString() {
        return productPo.toString();
    }
}
